﻿// This file is part of Code4Public (http://code4public.codeplex.com)
// Copyright 2011 Sina Iravanian - <sina@sinairv.com>
//
// This source file(s) may be redistributed, altered and customized
// by any means PROVIDING the authors name and all copyright
// notices remain intact.
// THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED. USE IT AT YOUR OWN RISK. THE AUTHOR ACCEPTS NO
// LIABILITY FOR ANY DATA DAMAGE/LOSS THAT THIS PRODUCT MAY CAUSE.
// ------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Code4Public.ThemeDesigners
{
    [DefaultEvent("BorderPropertiesChanged")]
    [DefaultProperty("Caption")]
    public partial class ThemeBorderDesigner : UserControl
    {
        public ThemeBorderDesigner()
        {
            InitializeComponent();
        }

        private bool eventSuspended = false;

        [Browsable(true)]
        public string Caption
        {
            get
            {
                return groupBorderDesigner.Text;
            }

            set
            {
                this.groupBorderDesigner.Text = value;
            }
        }

        public event EventHandler BorderPropertiesChanged;

        public void SuspendEventRaising()
        {
            eventSuspended = true;
        }

        public void ResumeEventRaising()
        {
            eventSuspended = false;
        }

        private void colorPicker_ColorChanged(object sender, EventArgs e)
        {
            if (!eventSuspended && BorderPropertiesChanged != null)
                BorderPropertiesChanged(this, new EventArgs());
        }

        private void borderEditor_BorderSelectionChanged(object sender, EventArgs e)
        {
            if (!eventSuspended && BorderPropertiesChanged != null)
                BorderPropertiesChanged(this, new EventArgs());
        }

        public bool BorderTop
        {
            get
            {
                return borderEditor.TopBorder;
            }

            set
            {
                borderEditor.TopBorder = value;
            }
        }

        public bool BorderLeft
        {
            get
            {
                return borderEditor.LeftBorder;
            }

            set
            {
                borderEditor.LeftBorder = value;
            }
        }

        public bool BorderBottom
        {
            get
            {
                return borderEditor.BottomBorder;
            }

            set
            {
                borderEditor.BottomBorder = value;
            }
        }

        public bool BorderRight
        {
            get
            {
                return borderEditor.RightBorder;
            }

            set
            {
                borderEditor.RightBorder = value;
            }
        }

        public Color BorderColor
        {
            get
            {
                return colorPicker.Color;
            }

            set
            {
                colorPicker.Color = value;
            }
        }


        

    }
}
